using RockBus.DataContracts;
using System;
using System.Configuration;
using System.ServiceModel.Configuration;

namespace RockBus.Hosting
{
    public class ReceivePortBehaviorExtensionElement : BehaviorExtensionElement
    {
        public ReceivePortBehaviorExtensionElement()
            : base()
        {
        }

        public override Type BehaviorType { get { return typeof(ReceivePortBehavior); } }

        protected override object CreateBehavior()
        {
            return new ReceivePortBehavior(new PublisherReceivePortInfo(this.PublisherId, this.ReceivePortId));
        }

        [ConfigurationProperty("publisherId", IsRequired = true)]
        public string PublisherId
        {
            get { return (string)base["publisherId"]; }
            set { base["publisherId"] = value; }
        }

        [ConfigurationProperty("receivePortId", IsRequired = true)]
        public string ReceivePortId
        {
            get { return (string)base["receivePortId"]; }
            set { base["receivePortId"] = value; }
        }
    }
}